home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 540 / text0000.txt < prev   
Encoding:
Text File  |  1996-08-05  |  2.4 KB  |  96 lines

  1. Here is a sorcecode for a sample DPMS blanker using ECS/AGA chipset :
  2.  
  3. Written for SAS_C 6.5 using outoinitialization of the system libraries.
  4.  
  5.  
  6. Comments are wellcomed (tell me if it work well with your monitor, config)
  7.  
  8. It work well with my Hyunda∩ 15" monitor. The DPSM level 2 makes a little
  9. noise in my monitor. Level 1 and 3 works quietely. I have an A4000.
  10.  
  11.  
  12. /***************************************************************************
  13.  * DPMS.c  (Sample code for DPMS blanking with ECS/AGA chipset.            *
  14.  * Leu Simon GRIS (7.1.96) Use it at your own risks (I take no             *
  15.  * responsability for the use of the code below. This code is freeware     *
  16.  * and released to the public domain.                                      *
  17.  ***************************************************************************
  18. */
  19.  
  20. #define __USE_SYSBASE 1
  21.  
  22. #include <exec/types.h>
  23. #include <proto/exec.h>
  24.  
  25. #include <proto/intuition.h>
  26.  
  27. #include <proto/graphics.h>
  28.  
  29. #include <dos/dos.h>
  30. #include <proto/dos.h>
  31.  
  32. #include <hardware/custom.h>
  33.  
  34. extern struct IntuitionBase *IntuitionBase;
  35. extern struct GfxBase *GfxBase;
  36. extern struct DosLibrary *DOSBase;
  37.  
  38. LONG main(VOID);
  39.  
  40. extern struct Custom __far custom;
  41.  
  42. LONG main(VOID)
  43. {
  44.   /* Get the addres of the current view */
  45.   struct View *view = ViewAddress();
  46.  
  47.   /* Reset the chipset registers. */
  48.   LoadView(NULL);
  49.  
  50.   /* Enable variable synchronization */
  51.   custom.beamcon0 = VARVSYNC | VARHSYNC;
  52.  
  53.   /* Perform DPMS level 1 */
  54.   custom.hsstrt = 0x0;
  55.   custom.hsstop = 0x0;
  56.  
  57.   custom.vsstrt = VGA_VSSTRT;
  58.   custom.vsstop = VGA_VSSTOP;
  59.  
  60.   Delay(50*10); /* Spend some time in DPMS1 state */
  61.  
  62.   DisplayBeep(NULL); /* Signal the user of next DPMS state */
  63.  
  64.   /* Perform DPMS level 2 */
  65.   custom.hsstrt = VGA_HSSTRT;
  66.   custom.hsstop = VGA_HSSTOP;
  67.  
  68.   custom.vsstrt = 0x0;
  69.   custom.vsstop = 0x0;
  70.  
  71.   Delay(50*10); /* Spend some time in DPMS2 state */
  72.  
  73.   DisplayBeep(NULL); /* Signal the user of next DPMS state */
  74.  
  75.   /* Perform DPMS level 3 lowest consumption) */
  76.   custom.hsstrt = 0x0;
  77.   custom.hsstop = 0x0;
  78.  
  79.   custom.vsstrt = 0x0;
  80.   custom.vsstop = 0x0;
  81.  
  82.   Delay(50*10); /* Spend some time in DPMS3 state */
  83.  
  84.   LoadView(view); /* Restore the displayed screen */
  85.  
  86.   DisplayBeep(NULL); /* Signal the user the last DPMS state has ended. */
  87.  
  88.   return( RETURN_OK );
  89. }
  90.  
  91.  
  92.  
  93. Simon Gris  FIDO 2:320/104.39  EMAIL: Simon.Gris@ramses.telesys-innov.fr
  94.                                       Simon.Gris@ramses.fdn.org
  95.  
  96.